<template>
  <div id="app">
    <!-- 动态背景装饰层 -->
    <div class="bg-decoration">
      <!-- 星光闪烁效果 -->
      <div class="stars-container">
        <div v-for="i in 20" :key="'star-' + i" class="star" :style="getStarStyle(i)"></div>
      </div>
      
      <!-- 浮动几何图形 -->
      <div class="shapes-container">
        <div class="shape shape-circle shape-1"></div>
        <div class="shape shape-square shape-2"></div>
        <div class="shape shape-triangle shape-3"></div>
        <div class="shape shape-circle shape-4"></div>
        <div class="shape shape-pentagon shape-5"></div>
        <div class="shape shape-hexagon shape-6"></div>
      </div>
    </div>
    
    <router-view />
  </div>
</template>

<script setup>
// 生成随机星星位置和动画
const getStarStyle = (index) => {
  const positions = [
    { top: '10%', left: '15%', animationDelay: '0s', animationDuration: '3s' },
    { top: '20%', left: '85%', animationDelay: '0.5s', animationDuration: '2.5s' },
    { top: '15%', left: '50%', animationDelay: '1s', animationDuration: '3.5s' },
    { top: '30%', left: '25%', animationDelay: '1.5s', animationDuration: '2.8s' },
    { top: '25%', left: '70%', animationDelay: '0.8s', animationDuration: '3.2s' },
    { top: '40%', left: '40%', animationDelay: '1.2s', animationDuration: '2.6s' },
    { top: '45%', left: '90%', animationDelay: '0.3s', animationDuration: '3.8s' },
    { top: '50%', left: '10%', animationDelay: '1.8s', animationDuration: '2.4s' },
    { top: '55%', left: '60%', animationDelay: '0.6s', animationDuration: '3.4s' },
    { top: '60%', left: '35%', animationDelay: '1.4s', animationDuration: '2.9s' },
    { top: '65%', left: '80%', animationDelay: '0.2s', animationDuration: '3.1s' },
    { top: '70%', left: '20%', animationDelay: '1.6s', animationDuration: '2.7s' },
    { top: '75%', left: '55%', animationDelay: '0.9s', animationDuration: '3.3s' },
    { top: '80%', left: '75%', animationDelay: '1.1s', animationDuration: '2.5s' },
    { top: '85%', left: '30%', animationDelay: '0.4s', animationDuration: '3.6s' },
    { top: '12%', left: '45%', animationDelay: '1.7s', animationDuration: '2.8s' },
    { top: '35%', left: '65%', animationDelay: '0.7s', animationDuration: '3.2s' },
    { top: '48%', left: '82%', animationDelay: '1.3s', animationDuration: '2.6s' },
    { top: '62%', left: '12%', animationDelay: '0.5s', animationDuration: '3.7s' },
    { top: '78%', left: '92%', animationDelay: '1.9s', animationDuration: '2.9s' },
  ];
  
  return positions[index - 1] || positions[0];
};
</script>

<style>
#app {
  min-height: 100vh;
  font-family: 'Microsoft YaHei', Arial, sans-serif;
  font-size: 18px;
  position: relative;
}

/* 背景装饰层容器 */
.bg-decoration {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* 星光闪烁效果 */
.stars-container {
  position: absolute;
  width: 100%;
  height: 100%;
}

.star {
  position: absolute;
  width: 3px;
  height: 3px;
  background: radial-gradient(circle, rgba(255, 255, 255, 1) 0%, rgba(139, 92, 246, 0.8) 50%, transparent 100%);
  border-radius: 50%;
  animation-name: twinkle;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.8), 0 0 20px rgba(236, 72, 153, 0.5);
}

@keyframes twinkle {
  0%, 100% {
    opacity: 0.3;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
  }
}

/* 浮动几何图形 */
.shapes-container {
  position: absolute;
  width: 100%;
  height: 100%;
}

.shape {
  position: absolute;
  opacity: 0.08;
  animation: float var(--float-duration, 20s) ease-in-out infinite;
}

/* 圆形 */
.shape-circle {
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
}

.shape-1 {
  width: 120px;
  height: 120px;
  top: 15%;
  left: 10%;
  animation-duration: 25s;
  animation-delay: 0s;
}

.shape-4 {
  width: 80px;
  height: 80px;
  bottom: 20%;
  right: 15%;
  animation-duration: 22s;
  animation-delay: 3s;
}

/* 正方形 */
.shape-square {
  background: linear-gradient(135deg, var(--accent-color), var(--primary-color));
  border-radius: 15px;
  transform: rotate(45deg);
}

.shape-2 {
  width: 100px;
  height: 100px;
  top: 45%;
  right: 8%;
  animation-duration: 28s;
  animation-delay: 2s;
}

/* 三角形 */
.shape-triangle {
  width: 0;
  height: 0;
  border-left: 50px solid transparent;
  border-right: 50px solid transparent;
  border-bottom: 90px solid rgba(236, 72, 153, 1);
}

.shape-3 {
  bottom: 30%;
  left: 12%;
  animation-duration: 24s;
  animation-delay: 1s;
}

/* 五边形 */
.shape-pentagon {
  width: 90px;
  height: 85px;
  background: linear-gradient(135deg, var(--success-color), var(--accent-color));
  clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
}

.shape-5 {
  top: 60%;
  left: 50%;
  animation-duration: 26s;
  animation-delay: 4s;
}

/* 六边形 */
.shape-hexagon {
  width: 110px;
  height: 95px;
  background: linear-gradient(135deg, var(--info-color), var(--primary-color));
  clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

.shape-6 {
  top: 25%;
  left: 75%;
  animation-duration: 30s;
  animation-delay: 5s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(30px, -40px) rotate(90deg);
  }
  50% {
    transform: translate(-20px, 30px) rotate(180deg);
  }
  75% {
    transform: translate(40px, 20px) rotate(270deg);
  }
}

/* 响应式调整 */
@media (max-width: 768px) {
  .star {
    display: none;
  }
  
  .shape {
    opacity: 0.05;
    animation-duration: 15s !important;
  }
  
  .shape-1, .shape-4 {
    width: 60px;
    height: 60px;
  }
  
  .shape-2 {
    width: 50px;
    height: 50px;
  }
  
  .shape-triangle {
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 50px solid rgba(236, 72, 153, 1);
  }
  
  .shape-pentagon {
    width: 50px;
    height: 45px;
  }
  
  .shape-hexagon {
    width: 60px;
    height: 50px;
  }
}
</style>
